import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TeamMemberVO, TeamMemberForm, TeamMemberQuery } from '@/api/business/teamMember/types';

/**
 * 查询人员信息列表
 * @param query
 * @returns {*}
 */

export const listTeamMember = (query?: TeamMemberQuery): AxiosPromise<TeamMemberVO[]> => {
  return request({
    url: '/business/teamMember/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询人员信息详细
 * @param baseId
 */
export const getTeamMember = (baseId: string | number): AxiosPromise<TeamMemberVO> => {
  return request({
    url: '/business/teamMember/' + baseId,
    method: 'get'
  });
};

/**
 * 新增人员信息
 * @param data
 */
export const addTeamMember = (data: TeamMemberForm) => {
  return request({
    url: '/business/teamMember',
    method: 'post',
    data: data
  });
};

/**
 * 修改人员信息
 * @param data
 */
export const updateTeamMember = (data: TeamMemberForm) => {
  return request({
    url: '/business/teamMember',
    method: 'put',
    data: data
  });
};

/**
 * 删除人员信息
 * @param baseId
 */
export const delTeamMember = (baseId: string | number | Array<string | number>) => {
  return request({
    url: '/business/teamMember/' + baseId,
    method: 'delete'
  });
};

/**
 * 是否展示
 */
export const visibleChange = (baseIds: Array<string | number>, status: boolean) => {
  return request({
    url: '/business/teamMember/visible',
    method: 'post',
    data: {
      baseIds: baseIds,
      status: status
    }
  });
};
/**
 * 审核
 */
export const auditChange = (baseIds: Array<string | number>, status: boolean, reason: string) => {
  return request({
    url: '/business/teamMember/audit',
    method: 'post',
    data: {
      baseIds: baseIds,
      status: status,
      reason: reason
    }
  });
};
